Plugin Manager Help - Script Packager - Packager Scripts


 

Packager scripts are simple text file scripts that are used to give the Packager commands to create packages automatically. Once you have created the script, you can simply run it to have the package created. The scripts also accept wildcards for the files, so it can add all files for the package with a few commands. This means that if a new version of the script adds new files, you dont need to adjust the packager script to include the file.

 


 

Creating Scripts

To create a script, you can use any text editor to create a text file, and set the file extension as .sbs

Each line of the script has commands telling the packager what to do next, any line starting with # will be skips, as will any black lines.

Like creating packages, the scripts also must contain the script name and author for it to work.

There is an example script availabe with the install of the program, bountyhunt.sps

You can also generate a packager script from the Packager itself, this can give you a base to work from, so you can just create the package as normal in the packager, the generate the packager script so next time you update, you only need to run the script instead of adding all the details/files again.

 


 

Auto Generating Packager Scripts

Fill in all the settings you require in the packager, then select the Generate Script option.

Generate

When selecting the option from the menu, you will be presented with the file dialog where you can enter the name you wish to save the packager script to.

Generate File

Once you have selected the file, you will be asked a Yes/No question if you wish to include wildcards.

Choosing yes will reduce the number of file entries via using Wildcards, otherwise each individual file will be added.

The script will then be generated and saved so you can edit it and change anything you wish.

 



Script Commands

Commands are all single words ending with a colon (:), followed by the data used.

 

You can use the various commands multiple times to add more than one file.

You can also generate the packager scripts automatically in the Script Packager.

 

Script Varibles

Some of the commands can make use of varibles to be replaced by the program.

You can also add your own varibles to use. To do that, you use the Varible: command, followed by the varible name. Varible names must start with $.

The you just use that name in the file commands to make use of the varibles, varibles must be defined before they are used.

 

These varibles are used within the AutoSave command to set the script name based on the script settings

You can use these varibles multiple times for the autosave command, ie $DEFAULTDIR$NAME-$VERSION-$DATE will be the same as the standard autosave directory.

If autosave command isn't set in the script, it just uses the default one

 

Using the Scripts

To use these scripts you can either load them into the program, IE double clicking them in windows so they load into the packager, this will casue the script to autosave.

You can also do it via the program itself, in the Scripts menu, there are two options for loading in the scripts "Load Packager Script" which reads the packager script and fills in the GUI with all the settings so you can then alter anything you need to and save the package.

Load

Or the "Auto Save From Packager Script" option allows you to read and save the script in one do, without having to enter anything.

Auto Save

 

Example

#
# Bounty hunters Guild packager script
# Created by Cycrow
#

# Set the varibles
# Useful for directories, so you can change it for all files easily
# Varibles always start with $
Varible: $DIR J:\Games\X3

# Sets the name of the script, all packager scripts must include this
Name: Bounty Hunters Guild

# Script name for differnet languages, ScriptName: [language] [script name]
ScriptName: English Bounty Hunters Guild

# Sets the name of the Author, all packager scripts must include this
Author: Cycrow

# The script version number, can use the $ASK varible
# The $ASK varible will bring up an input for you to enter the version number
Version: $ASK

# The script creation date, cam use the $ASK and $DATE varibles
# The $ASK varible will bring up an input for you to enter the date
# The $DATE varible will use the current system date
Date: $DATE

# Game version the package is for, 0 = All, 1 = X2, 2 = X3, 3 = X3 + BalaGi
GameVersion: 2

# The website address for the script, ie the egosoft forum page for the script
WebSite: http://forum2.egosoft.com/viewtopic.php?t=96778

# The email address for the author.
Email: cycrow@ircwhore.co.uk

# Enter the web address the script can be downloaded from
# Should be without the file name
# IE, ircwhore.co.uk/x3/scripts/BountyHuntersGuild.spk would just be, ircwhore.co.uk/x3/scripts
WebAddress: http://ircwhore.co.uk/x3/scripts

# Mirror addresses, you can set 2 extra address to be used as mirrors if the main one fails
WebMirror1: http://86.20.164.192/x3/scripts
WebMirror2: http://player-vs-player.com/X3/Cycrow

# The icon file to use for your scripts, either png or bmp format
Icon: $DIR\Icons\bountyhunt.png

# Uninstall Texts
# Displays text before or after the unistall process to adivce users what to do
# The texts can be set in differnet languages depending on what the user is currently running
# Before Text:
UninstallBefore: English Continue with uninstall ?
# After Text:
UninstallAfter: English Unisntall script has be loaded, run the game for the effects to take place.

# Add the scripts files, these are installed into the scripts directory
Script: $DIR\Scripts\al.plugin.bountyguild.xml
Script: $DIR\Scripts\al.bountyhunt.*

# Add any shared scripts files, these dont get removed when uninstalling
SharedScript: $DIR\Scripts\lib.cycrow.*

# Add any Text files using Text: command
# Add shared Text files using SharedText, these are installed into the t direcory
SharedText: $DIR\t\447532.xml
SharedText: $DIR\t\497532.xml

# Add the Readme to include with the script
Readme: $DIR\MyScripts\BH-X3\Readme\bh-readme*.*

# Adds any map script files
Map: $DIR\Maps\map.xml
SharedMap: $DIR\Maps\map.shared.xml

# Adds any mod files the script might use
# If the mod file is a number, ie 06.cat/06.dat, they will be installed in the normal x3 directory and act as a "fake patch"
# IF the mod file is something else, its installed in the mods directory
Mod: $DIR\07.*

# Uninstall Script Files
# Scripts files that arnt placed in the scripts directory when installed, these are moved there one you uninstall the game
# This allows you to remove anything in the world that the script would create
Uninstall: $DIR\Scripts\setup.bountyhunt.uninstall.xml

# Sound files
# These are installedi nto the sound track directory to replace the existing sector and battle music
Sound: $DIR\MyScripts\Sounds\00007.mp3

# Extra files
# Adds extra files into the script package, these can be any files you like, and can be added to any directory, the default is X3/Extras/$scriptname
# You can set the directory to install too buy using the pipe character '|'
Extra: $DIR\MyScripts\guildpromotion.lcd|LCD\BountyHunt

# Set the file name to save as, if none is set, uses the default filename
# Can use various varibles to create filename
# $DEFAULTDIR - replaces with the default destination directory set in the packager
# $AUTOSAVE - replaces with the auto save filename, "ScriptName-Version-dd.mm.yyyy.spk"
# $Name - replaces with the script name
# $Version - Replaces with the script version number
# $Author - Replaces with the script author
# $Date - replaces with the script creation date
# Default = $DEFAULTDIR$AUTOSAVE
# $AUTOSAVE = $NAME-$VERSION-$DATE.spk
AutoSave: $DIR\$AUTOSAVE

# Automatic FTP Uloading
# Sets uploading to enable and sets address and port
# FtpUpload: <address> [port]
FtpUpload: ftp.ircwhore.co.uk 21

# Sets the username to login as
FtpUser: cycrow

# Sets the password to use to login
FtpPass: password

# Sets the directory to upload files to
FtpDir: /home/cycrow

You can find the example file in the examples directory, called bountyhunt.sps